/*
 *  (C) Copyright 2008 Insula T.I. Ltda.
 * 
 *  This file is part of Vulcano.
 *
 *  Vulcano is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU Lesser General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  Vulcano is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU Lesser General Public License for more details.
 *
 *  You should have received a copy of the GNU Lesser General Public License
 *  along with Vulcano.  If not, see <http://www.gnu.org/licenses/>.
 */
package org.openinsula.vulcano.orm.command;

import java.io.Serializable;
import java.util.List;

import org.openinsula.vulcano.core.command.Command;
import org.openinsula.vulcano.core.command.invoker.CommandInvoker;
import org.openinsula.vulcano.orm.InitializingCallback;
import org.openinsula.vulcano.orm.command.factory.CommandFactory;
import org.openinsula.vulcano.orm.dao.Dao;
import org.openinsula.vulcano.orm.dao.query.DaoQuery;

/**
 * Interface that mimics commons {@link Dao} methods, just to ease common
 * operations and avoid the use of {@link CommandFactory}. It is up to the
 * developer to choose the preferred approach.
 * 
 * @author yanaga
 * @author rebola
 * @since 1.0
 * @see Command
 * @see CommandInvoker
 * @see CommandTemplate
 * @see Dao
 */
public interface CommandOperations {

	public <T> T findById(Class<T> entityClass, Serializable id);

	public <T> T findById(InitializingCallback<T> callback, Class<T> entityClass, Serializable id);

	public <T> T findUnique(DaoQuery<T> daoQuery);

	public <T> T findUnique(InitializingCallback<T> callback, DaoQuery<T> daoQuery);

	public <T> List<T> find(DaoQuery<T> daoQuery);

	public <T> List<T> find(InitializingCallback<T> callback, DaoQuery<T> daoQuery);

	public void persist(Object... entities);

	public void remove(Object... entities);

	public void refresh(Object... entities);

	public <T> void refresh(InitializingCallback<T> callback, T... entities);

}